//package com.wjk.kylin.mall.order.mq;
//
//import org.springframework.amqp.core.*;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//
//import java.util.HashMap;
//import java.util.Map;
//
//
//@Configuration
//public class DirectDeadRabbitConfig {
//
//    public static final String NORMAL_EXCHANGE = "normal_exchange";
//    public static final String DEAD_EXCHANGE = "dead_exchange";
//
//    public static final String NORMAL_QUEUE = "normal_queue";
//    public static final String DEAD_QUEUE = "dead_queue";
//
//    public static final String NORMAL_KEY = "normal_key";
//    public static final String DEAD_KEY = "dead_key";
//
//    @Bean
//    public Exchange normalExchange() {
//        return ExchangeBuilder.directExchange(NORMAL_EXCHANGE).durable(true).build();
//    }
//
//    @Bean
//    public Exchange deadExchange() {
//        return ExchangeBuilder.directExchange(DEAD_EXCHANGE).durable(true).build();
//    }
//
//    @Bean
//    public Queue normalQueue() {
//        Map<String, Object> map = new HashMap<>();
//        map.put("x-dead-letter-exchange", DEAD_EXCHANGE);
//        map.put("x-dead-letter-routing-key", DEAD_KEY);
//        //过期时间
////        args.put("x-message-ttl",2000);
//        return QueueBuilder.durable(NORMAL_QUEUE).withArguments(map).build();
//    }
//
//    @Bean
//    public Queue deadQueue() {
//        return QueueBuilder.durable(DEAD_QUEUE).build();
//    }
//
//    @Bean
//    public Binding deadBinding() {
//        return new Binding(DEAD_QUEUE, Binding.DestinationType.QUEUE, DEAD_EXCHANGE, DEAD_KEY, null);
//    }
//
//    @Bean
//    public Binding normalBinding() {
//        return new Binding(NORMAL_QUEUE, Binding.DestinationType.QUEUE, NORMAL_EXCHANGE, NORMAL_KEY, null);
//    }
//
//}
